template<typename DT>           // Define List
class SingleNode
{
    private:
        DT element;
        SingleNode* next;
    public:
        DT getElement() const {return element;}
        void setElement(DT _val) {element = _val;}
        SingleNode* getNext() const {return next;}
        void setNext(SingleNode* _nt) {next = _nt;}
};

template<typename DT>
class DoubleNode
{
    private:
        DT element;
        DoubleNode* next;
        DoubleNode* previous;
    public:
        DT getElement() const {return element;}
        void setElement(DT _val) {element = _val;}
        DoubleNode* getNext() const {return next;}
        void setNext(DoubleNode* _nt) {next = _nt;}
        void setPrevious(DoubleNode* _pv) {previous = _pv;}
};

// 抽象的节点类
template<typename DT>
class node
{
    private:
        DT element;
    public:
        virtual DT getElement() const {return element;}
        virtual void setElement(DT _val) {element = _val;}
        Node(DT _val) {element = _val;}
};

template<typename DT>
class List
{
    public:
        virtual void insert(DT _val) = 0;
        virtual void remove(DT _val) = 0;
};

template<typename DT>
class SingleNode : public List<DT>
{
    private:
        class SingleNode : public Node<DT>
        {
            private:
                SingleNode* next;
            public:
                virtual SingleNode* getNext() const {return next;}
                virtual void setNext(SingleNode* _nt) {next = _nt;}
                SingleNode(DT _val) : Node<DT>(_val) {next = nullptr;}
                SingleNode* head = nullptr;
                SingleNode* currentPosition = nullptr;
        }
};

